package com.yjd.bi.canal.service;

import com.yjd.comm.base.enums.DbWREnums;
import com.yjd.comm.base.service.IBaseService;
import com.yjd.comm.util.FrameUtil;

import java.util.List;
import java.util.Map;

import com.yjd.bi.canal.model.CanalMessageModel;
import com.yjd.bi.canal.model.Records;

/**
 * <b>description</b>：客户消息订单业务接口<br>
 * <b>time</b>：2016-07-13 15:14:27 <br>
 * <b>author</b>：  ready percy-chen@hotmail.com
 */
public interface ICanalMessageService extends IBaseService {
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public CanalMessageModel insert(CanalMessageModel model) throws Exception;

	/**
	 * 更新,大于等于1表示成功，其他失败
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(CanalMessageModel model) throws Exception;

	/**
	 * 根据id删除,大于等于1表示成功，其他失败
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(long id) throws Exception;

	public void inserBatch(List<CanalMessageModel> list) throws Exception;
	
	public int updateByCanalMessage(String table,Records keymap,List<Records> changeList) throws Exception;
	
	public Map insertByCanalMessage(String table,List<String> fieldList,List<String> valueList) throws Exception;
	
	public int deleteByCanalMessage(String table,Records keymap) throws Exception;
	
	/**
	 * 将canal的message转为本地数据，对应执行相应的insert,update,delete
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public boolean transfer(List<CanalMessageModel> list) throws Exception;
	
	public List getTableList(DbWREnums dbwr)			throws Exception;
	
	public CanalMessageModel insertLog(CanalMessageModel model) throws Exception;
	
	/**
	 * 移动处理过的model到新表
	 * @param m
	 * @throws Exception
	 */
	public void moveToLog(List<CanalMessageModel> ms) throws Exception;
}

